package day4;

import java.util.Scanner;

/**
 * @author oldliu
 * @since 1.0
 */
public class Huangou {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        System.out.println("请输入购物金额：");
        double m = in.nextDouble();
        System.out.println(" 1:购物超过50元，加1元换购500毫升可乐；\n" +
                "  2:购物超过100元，加2元换购1000毫升果汁；\n" +
                "  3:购物超过100元，加4元换购炫迈口香糖一瓶；\n" +
                "  4:购物超过200元，加38元换购一瓶进口红酒；\n" +
                "  5:购物超过200元，加15元换购1袋面粉；\n" +
                "  0:不换购");
        int choice = in.nextInt();
        switch (choice) {
            case 1:
                if (m > 50) {
                    System.out.println("成功换购一瓶可乐");
                    m += 1;//m=m+1
                } else {
                    System.out.println("钱不够，不能换可乐");
                }
                System.out.println("应付：" + m + "元");
                break;

            case 2:
                if (m > 100) {
                    System.out.println("成功换购一瓶果汁");
                    m += 2;
                } else {
                    System.out.println("钱不够，不能换果汁");
                }
                System.out.println("应付：" + m + "元");
                break;
            case 3:
                if (m > 100) {
                    System.out.println("成功换购一瓶炫迈");
                    m += 4;
                } else {
                    System.out.println("钱不够，不能换炫迈");
                }
                System.out.println("应付：" + m + "元");
                break;
            case 4:
                if (m > 200) {
                    System.out.println("成功换购一瓶红酒");
                    m += 38;
                } else {
                    System.out.println("钱不够，不能换红酒");
                }
                System.out.println("应付：" + m + "元");
                break;
            case 5:
                if (m > 200) {
                    System.out.println("成功换购一袋面粉");
                    m += 15;
                } else {
                    System.out.println("钱不够，不能换面粉");
                }
                System.out.println("应付：" + m + "元");
                break;
            default:
                System.out.println("应付：" + m + "元");
                break;
        }
    }
}
